
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>数据消息</title>
    <link type="text/css" href="../../../res/css/style.css" rel="stylesheet" />
    <script type="text/javascript" src="../../../res/js/jquery-3.1.1.min.js"></script>
    <script type="text/javascript" src="../../../res/layui/layui.js"></script>
    <script type="text/javascript" src="../../../res/js/jqueryform.js"></script>
    <script language="javascript">
        $(function(){
            function test(func){
                var start = new Date().getTime();
                func();
                var end = new Date().getTime();
                return (end - start)+"ms";
            }
            $('.form').inform();
        });
    </script>
</head>
<body>
<div class="form">
    <form action="" method="post" name="myform" id="myform" enctype="multipart/form-data">

        <input type="hidden"  id="dicId"  name="dicId" class="width" />


        <div class="item">
            <span>字典编码：</span>
            <label><input type="text" name="dicEncoding"  id="dicEncoding" lay-verify="required" maxlength="10" class="width" placeholder="请输入字典编码" /></label>
        </div>
        <div class="item">
            <span>字典名称：</span>
            <label><input type="text" class="width" name="dicName" id="dicName"  maxlength="10"   placeholder="请输入名称"/> </label>
        </div>
        <div class="item " >
            <span>字典类型：</span>
            <label><input type="text" class="width" name="dicType" id="dicType"  maxlength="6" placeholder="请输入类型"/> </label>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"><?php echo $info['DisplayName'];?></label>
            <div class="layui-input-block">
                <textarea id="remark" name="remark" maxlength="200"  type="text/plain" style="width:497px;height:118px;margin: 0px 0px 0px 64px;"  placeholder="输入备注" ></textarea>
            </div>
        </div>
        <div class="item " >
            <span>禁&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;忌：</span>
            <label><input type="text" class="width" name="oper" id="oper"  maxlength="50"  placeholder="填写禁忌"/> </label>
        </div>
        <div class="item">
            <span></span>
            <div id="div" style="margin-left: 240px">
                <label><button type="button" id="btn" >提交</button></label>
                <label><button type="submit">重置</button></label>
            </div>
        </div>
    </form>
</div>

<script>
    layui.use(['form', 'layedit', 'laydate'], function() {
        var form = layui.form
        var table = layui.table
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate;
        $(function () {
            $("#btn").click(function () {
                var url="/hqDatadic/insertOn";
                var formDate = new FormData(document.getElementById("myform"));
                $.ajax({
                    url:url,
                    data:formDate,
                    processData:false,
                    contentType:false,
                    dataType:'json',
                    type:'POST',
                    success:function (obj) {
                        layer.msg(obj.message)
                        if(obj.status == 1){
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.table.reload("testReload");
                            parent.layer.close(index);
                            parent.layer.msg(obj.message);
                        }
                    },
                })
            })
        })
        $("#dicEncoding").on("blur",function(res){
            reg = /^\w+$/;
            if(reg.test(this.value)){

            }else {
                layer.msg("编码请输入字母或数字"),{
                    icon: 1,
                    time: 1000 //1秒关闭（如果不配置，默认是3秒）
                },function () {

                }
                $("#dicEncoding").val("")
            }
        })
    });
</script>
</body>
</html>